package com.naiterui.ehp.bs.esign.controller.inner;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bp.support.exception.PublicService;
import com.naiterui.ehp.bp.support.exception.ResponseVO;
import com.naiterui.ehp.bs.esign.exception.ExceptionCodes;
import com.naiterui.ehp.bs.esign.api.bjca.util.SignYwxUtil;
import com.naiterui.ehp.bs.esign.api.bjca.vo.YwxAccessToken;

/**
 * @author guoyongxiang
 * @date 2019/12/3 19:09
 * @since 1.0.0
 */
@RequestMapping("esign/inner/task")
@RestController
public class EsignInnerTaskController {

    private static final Logger LOGGER = LoggerFactory.getLogger(EsignInnerTaskController.class);

    /**
     * 医网信accessToken刷新
     *
     * @return
     *
     * @throws BusinessException
     */
    @RequestMapping("esgin/accessToken/refresh")
    public ResponseVO<YwxAccessToken> esginAccessTokenRefresh() throws BusinessException {
        YwxAccessToken accessTokenVO = SignYwxUtil.refreshAccessToken();
        LOGGER.info("刷新医网信 accessTokenVO:{}", accessTokenVO);
        return PublicService.returnResponseVO(ExceptionCodes.SUCCESS, accessTokenVO);
    }
}
